import java.util.Scanner;
import java.util.Stack;

class Node {
    int val;
    Node next;
    public Node() {

    }
    public Node(int val) {
        this.val = val;
    }
}
class MyStack{
    int[] elem;
    int size;
    public MyStack(int a) {
        elem = new int[a];
        size = 0;
    }

    public void push(int val) {
        elem[size] = val;
        size++;
    }
    public int pop() {
        return elem[--size];
    }
    public int top() {
        return elem[size-1];
    }
}
public class Main {



    public static void ptint(Stack p) {
        p.pop();
        if(p.size()!=0) {
            ptint(p);
            System.out.print(p.peek());
        }
        return;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        Stack<Character> stack = new Stack();
        for(int i = 0; i < s.length();i++) {
            if(stack.empty()) {
                stack.push(s.charAt(i));
            } else {
                if(stack.peek() == s.charAt(i)) {
                    stack.pop();
                } else {
                    stack.push(s.charAt(i));
                }
            }
        }
        if(stack.empty()) {
            System.out.println(0);
        } else {
            ptint(stack);
        }
    }
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        MyStack myStack = new MyStack(a);

    }
    // 递归方式
    void printList(Node head){
        if(null != head){
            printList1(head.next);
            System.out.print(head.val + " ");
        }
    }
    // 循环方式
    void printList1(Node head) {
        if (null == head) {
            return;
        }
    }
    public static void main1(String[] args) {
        MinStack minStack = new MinStack();
        minStack.push(4);
        minStack.push(5);
        minStack.push(1);
        minStack.push(3);
        minStack.push(-2);
        minStack.getMin();
        minStack.pop();
        minStack.top();
        minStack.getMin();
        minStack.pop();
        Scanner sc = new Scanner(System.in);
        System.out.println(minStack.getMin());
    }
}